#include "pickgui.h"
#include "GraphicsItem.h"
#include <gui\graphicsview\qgraphicsscene.h>
#include <gui\graphicsview\qgraphicsview.h>
#include <corelib\tools\qpoint.h>


PickGui::PickGui(QWidget *parent , Qt::WFlags flags)
: QMainWindow(parent, flags)
{
	ui.setupUi(this);
	LoadItems();

	QObject::connect(ui.pBStart, SIGNAL(clicked()), this, SLOT(onStartClicked()));

}


PickGui::~PickGui()
{

}

void PickGui::onStartClicked()
{
	UpdateItems();
	emit PickGuiOnStartClicked();
}

void PickGui::LoadItems()
{
	mGraphicsScene.setSceneRect(-300, -300, 600, 600);
	mGraphicsScene.setItemIndexMethod(QGraphicsScene::NoIndex);

	for (int i = 0; i < 3; ++i) {
		GraphicsItem *item = new GraphicsItem;
		item->setPos(i*50,i*50);
		mGraphicsScene.addItem(item);
	}	

	ui.graphicsView->setScene(&mGraphicsScene);


}

void PickGui::UpdateItems()
{


	for(int i = 0; i < mGraphicsScene.items().count(); i++)
	{
		mGraphicsScene.items().at(i)->moveBy(20,20);
	}
	

}




